<?php
$games = array('Game 1', 'Game 2', 'Game 3');
$rules = array('Rule 1', 'Rule 2', 'Rule 3');

$link = mysql_connect('localhost', 'root', '');
if(!$link)
{
	die('Not connected : '.mysql_error());
}
$db = mysql_select_db('games');
if(!$db)
{
	die ('Can\'t use foo : '.mysql_error());
}
$query = 'SELECT * FROM games order by Title';
$result = mysql_query($query);
$PageTitle = 'Example Page';
include('includes/header.php');
?>
	<div id="accordion">
		<?php
			foreach($games as $game) {
			echo '<div>
					<h3><a href="#">'.$game.'</a></h3>
					<div><div class="tabs">
						<ul>';
							$i = 1;
							foreach($rules as $rule)
							{ 
								echo '<li><a href="#tabs-'.$i.'">'.$rule.'</a></li>';
							 	$i++;
							}
						echo '</ul>';
						$i = 1;
						foreach($rules as $rule)
						{
							echo '<div id="tabs-'.$i.'">Lorem impsum. '.$game.' '.$rule.'</div>';
							$i++;
						}
					echo '
					</div>
				</div>
			</div>';
			}
		?>
		<div>
			<h3><a href="#">Test</a></h3>
			<div>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. 
					Lorem ipsum dolor sit amet.</div>
		</div>
	</div>
	
		<table>
			<tr>
				<th>Game title</th>
				<th>Rules</th>
				<th>Players</th>
			</tr>
			<?php 
				while ($row = mysql_fetch_assoc($result))
				{
					echo '<tr>';
					echo '<td>'.$row['Title'].'</td>';
					echo '<td>'.$row['Rules'].'</td>';
					echo '<td>'.$row['Players'].'</td>';
					echo '</tr>';
				}
			?>
		</table>
		

<?php include('includes/footer.html')?>
	</body>
</html>




